package com.jxm.annotation;

import com.jxm.validation.UsernameValidator;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;

@Retention(RetentionPolicy.RUNTIME)
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER})
@Documented
@Constraint(validatedBy = {UsernameValidator.class})

public @interface Username {
    String message() default "用户名4-16位且不包含特殊字符~";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
